Skip to content

fix(queue): require a selected project before loading work#3743

Closed
CompleteDotTech wants to merge 36 commits into
OpenCoven:mainfrom
CompleteDotTech:agent/queue-project-readiness
Closed

fix(queue): require a selected project before loading work#3743
CompleteDotTech wants to merge 36 commits into
OpenCoven:mainfrom
CompleteDotTech:agent/queue-project-readiness

Conversation

@CompleteDotTech

Copy link
Copy Markdown
Member

Summary

  • persist a Queue-specific selected project and validate it before every Queue load
  • require Queue project selection in onboarding and reopen it at launch when the path is stale or unavailable
  • add a Queue Generate action that initializes Beads only in the selected Git repository

Validation

  • pnpm typecheck
  • focused readiness, onboarding, Queue-view, and API-contract tests
  • pnpm check:tests-wired
  • pnpm test reached 762 passing app test files before the unchanged changes-summary-fetch.test.ts TTL assertion failed (1 !== 2 after its 4.1s wait)

Closes cave-dsbj

@BunsDev
BunsDev self-requested a review July 24, 2026 02:00
@BunsDev

BunsDev commented Jul 24, 2026

Copy link
Copy Markdown
Member

Pushed a9e3d0398 (maintainer edit) to get E2E green: the dismissal override force-opened the Onboarding dialog over every surface in the daemon-less harness — all 15 pre-existing specs timed out behind the aria-modal overlay (subtree intercepts pointer events, 25m job timeout on run 30067639031).

Why the queue-project seeding in 0ad9d2a7d alone doesn't cover it: the CI checkout has a tracked .beads/ directory, so beadsWorkspaceStatus reaches the bd ready probe — and the E2E runner never installs bdbeads-unavailableok=false, canGenerate=falseproject.ok=false → wizard reopens despite the stored dismissal.

Fix: the status route now reports the project step satisfied under COVEN_CAVE_E2E=1, mirroring the existing harness short-circuits (playwright.config.ts daemon stub, mobile-access-provision.ts). Real runs keep the full readiness probe; onboarding-wizard and familiar-work-queue specs mock /api/onboarding/status wholesale, so project-readiness coverage is unchanged. Verified locally: route+gate unit tests, calendar-month-grid (previously pointer-blocked), all 13 wizard + 14 queue tests pass.

@CompleteDotTech
CompleteDotTech force-pushed the agent/queue-project-readiness branch from a9e3d03 to 9f55321 Compare July 24, 2026 05:52
@BunsDev

BunsDev commented Jul 24, 2026

Copy link
Copy Markdown
Member

Pushed d1828a429 — the remaining E2E failure was the mobile code-rail sheet spec: with the dismissed short-circuit removed, every spec boot now fetches /api/onboarding/status for real, and that route's cold compile + probes race the lazy code-rail chunk on pixel-5 (deterministic locally at 9f55321b0: sheet dialog renders empty past the 5s expect; passes on main). Fixed by mocking the status route in the spec's base(), same shape familiar-work-queue.spec.ts uses — per the harness contract that specs are self-contained. Verified green across pixel-5/iphone-13/desktop with --repeat-each=2.

@BunsDev

BunsDev commented Jul 24, 2026

Copy link
Copy Markdown
Member

All four required checks are green at d1828a429 (E2E included). Left unmerged since this is still marked draft and you've been iterating — mark it ready whenever you're done and it can merge as-is. If you'd like me to merge it at this tip, say the word.

CompleteDotTech and others added 10 commits July 24, 2026 02:38
The new dismissal override (a stored dismissal must not mask a missing
Queue project) force-opened the Onboarding dialog over every surface in
CI: the daemon-less e2e run (COVEN_CAVE_E2E=1) never has a selected
project, so all 15 pre-existing specs — which follow the documented
contract of setting cave:onboarding:dismissed=1 and mocking /api/* —
timed out behind the aria-modal overlay ('subtree intercepts pointer
events', 25m job timeout).

Stub the project step ok in the harness, mirroring the existing
COVEN_CAVE_E2E short-circuits (playwright.config.ts, mobile-access-
provision.ts). Real runs keep the readiness probe; onboarding-wizard
and familiar-work-queue specs mock this route wholesale, so project-
readiness coverage is unchanged.

Verified locally: route + gate unit tests ok; calendar-month-grid (a
previously pointer-blocked legacy spec), all 13 onboarding-wizard and
all 14 familiar-work-queue tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
With the dismissed short-circuit gone every boot fetches
/api/onboarding/status for real; its cold compile + probes race the
lazy code-rail chunk on pixel-5 and the sheet renders empty past the
5s expect (the exact E2E failure on this PR's last run). Mock the
route like familiar-work-queue.spec.ts already does — specs are
self-contained per the harness contract.

Verified: code-rail-sheet green across pixel-5/iphone-13/desktop with
--repeat-each=2 (was: deterministic pixel-5 fail at this tip).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@CompleteDotTech
CompleteDotTech force-pushed the agent/queue-project-readiness branch from d1828a4 to df939a4 Compare July 24, 2026 06:50
@CompleteDotTech
CompleteDotTech marked this pull request as ready for review July 24, 2026 07:12
@CompleteDotTech

Copy link
Copy Markdown
Member Author

Ready for review, @BunsDev.

Rebased onto current main and pushed exact head f564ec0. This resolves the packaged launch-PATH readiness gap, presents Git before the now-required Queue-project step, synchronizes Queue project changes across Cave windows, and adds accessible reload/focus handling.

The first exact-head E2E run exposed a test-fixture ordering bug in the new two-window coverage; fixed in f564ec0. Full exact-head CI is green: Frontend, Playwright, Rust, CodeQL, cross-environment (Ubuntu/Windows), and sidecar runtime (Ubuntu/Windows). Local verification included pnpm build, typecheck, Queue readiness/API tests, and Queue Playwright 16/16.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes Queue loads explicitly depend on a persisted, Queue-specific selected Git project, ensuring Queue never falls back to the app runtime cwd and that cross-window Queue selection stays consistent.

Changes:

  • Add Queue project selection persistence + readiness probing (Git/Beads validation) and require it before reading/mutating Queue work.
  • Update onboarding/startup gating to require Git + Queue project selection (with e2e-safe stubbing and new UI for picking the Queue project).
  • Scope Beads/PR bridge calls (read + mutations) to an explicit projectRoot, and add Generate to initialize Beads only in the selected repo.

Reviewed changes

Copilot reviewed 42 out of 42 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/onboarding-wizard.spec.ts Adds onboarding status fixtures and coverage for Git-before-project Queue setup.
tests/mobile/code-rail-sheet.spec.ts Mocks onboarding status probe now that startup always checks onboarding status.
tests/familiar-work-queue.spec.ts Expands Queue e2e coverage for projectRoot scoping, switching, and Generate conflicts.
tests/chat-boot-landing.spec.ts Ensures dismissed onboarding stays closed with seeded Queue project baseline.
src/lib/surface-warmup-registry.ts Removes Queue warmup resource that previously made unscoped Queue reads.
src/lib/server/issue-worktree-provision.ts Spawns git with caveToolSpawnEnv() to honor launch PATH for Queue tooling.
src/lib/server/beads-workspace.ts Adds safe .beads workspace resolver that rejects symlinks / unsafe targets.
src/lib/server/beads-workspace.test.ts Verifies .beads symlink rejection to avoid cross-project mutation.
src/lib/server/beads-cli.ts Switches bd env construction to caveToolSpawnEnv() + required vars.
src/lib/server/backup-manifest.ts Includes queue-project.json in Cave backup set.
src/lib/server/backup-manifest.test.ts Ensures backups include Queue project selection state.
src/lib/queue-project-selection.ts Adds local + BroadcastChannel propagation for Queue project selection changes.
src/lib/queue-project-readiness.ts Implements selection persistence and readiness validation (Git/Beads) + caching.
src/lib/queue-project-readiness.test.ts Exercises Queue readiness contract and key route invariants.
src/lib/onboarding-gate.ts Treats missing Queue project as a structural onboarding requirement.
src/lib/onboarding-gate.test.ts Adds test ensuring Queue project unavailability reopens onboarding.
src/lib/coven-bin.ts Introduces caveToolSpawnEnv() preserving launch PATH precedence for Queue tools.
src/lib/coven-bin.test.ts Verifies Queue tooling PATH precedence and required spawn-site usage.
src/components/workspace.tsx Ensures dismissed onboarding doesn’t mask a required Queue project failure.
src/components/onboarding-overlay.tsx Makes Git required; adds a Queue project picker step and selection publishing.
src/components/onboarding-model.ts Adds project step to onboarding model.
src/components/onboarding-guided-steps.test.ts Guards against out-of-order Queue-project selection UI state updates.
src/components/familiar-work-queue-view.tsx Loads readiness first; scopes reads/mutations by projectRoot; adds Generate and focus/announce handling on project switch.
src/components/familiar-work-queue-view.test.ts Updates assertions to match explicit readiness + projectRoot scoping behavior.
src/components/familiar-work-queue-sections.tsx Scopes bead detail reads to projectRoot.
src/components/board-view.tsx Stops invalidating removed Queue warm resource when board reloads/mutates.
src/components/asana-queue-strip.tsx Scopes filing beads from Asana to the selected Queue projectRoot.
src/app/api/queue/readiness/route.ts Adds loopback-only Queue readiness + selection + Generate (serialized per repo).
src/app/api/queue/readiness/route.test.ts Verifies Generate identity binding, locking, idempotency, and partial-workspace handling.
src/app/api/onboarding/status/route.ts Makes Git + Queue project required; uses cached Queue readiness; e2e harness bypass.
src/app/api/onboarding/status/route.test.ts Updates contract checks for required Git + project step and cached readiness usage.
src/app/api/beads/route.ts Requires projectRoot (no cwd fallback), uses safe workspace resolver, reuses readiness probe for ready mode.
src/app/api/beads/route.test.ts Verifies all Beads reads/mutations and PR bridge stay scoped to selected repo root.
src/app/api/beads/prs/route.ts Requires projectRoot and runs gh with caveToolSpawnEnv().
src/app/api/api-contracts.test.ts Registers /queue/readiness in API contracts with local-origin guard.
src-tauri/src/sidecar_archive_manifest.rs Bumps sidecar archive max file count for new traced files.
scripts/sidecar-runtime-smoke.mjs Updates runtime file-count budget assertions.
scripts/sidecar-runtime-closure.test.mjs Updates file-count budget checks.
scripts/sidecar-runtime-closure.mjs Updates documented runtime file-count budget rationale.
scripts/sidecar-bundle-deps.test.mjs Updates expected budget references and Rust extractor constant match.
scripts/run-tests.mjs Wires new tests into suites/alias loader lists.
playwright.config.ts Seeds Queue project selection alongside projects for daemon-less e2e baseline.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lib/queue-project-readiness.ts
BunsDev added a commit that referenced this pull request Jul 24, 2026
His fork branch for #3743 became unreachable, so the work re-lands
through this internal branch; record the attribution it is due.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@BunsDev

BunsDev commented Jul 24, 2026

Copy link
Copy Markdown
Member

Superseded by #3765: this PR's head branch (agent/queue-project-readiness on the fork, now apple-techie/coven-cave) was deleted, so the open review feedback could not be pushed here. #3765 re-lands all 21 commits with authorship intact plus the review fix, and adds @CompleteDotTech to CONTRIBUTORS.md. Closing in favor of #3765.

@BunsDev BunsDev closed this Jul 24, 2026
@CompleteDotTech
CompleteDotTech deleted the agent/queue-project-readiness branch July 24, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants